# frozen_string_literal: true

require "rails"
require "decidim/core"

module Decidim
  module <%= component_module_name %>
    # This is the engine that runs on the public interface of <%= component_name %>.
    class Engine < ::Rails::Engine
      isolate_namespace Decidim::<%= component_module_name %>

      routes do
        # Add engine routes here
        # resources :<%= component_name %>
        # root to: "<%= component_name %>#index"
      end

      initializer "<%= component_module_name %>.shakapacker.assets_path" do
        Decidim.register_assets_path File.expand_path("app/packs", root)
      end

      initializer "<%= component_module_name %>.data_migrate", after: "decidim_core.data_migrate" do
        DataMigrate.configure do |config|
          config.data_migrations_path << root.join("db/data").to_s
        end
      end
    end
  end
end
